import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import styles from './index.less';

import CardC from '../Barra/comps/cardC';

class CardBorderBox extends PureComponent {
  render() {
    const { title, children, backToMinus } = this.props;
    return (
      <div className={styles.CardBorderBox}>
        <div className={styles.CardBox}>
          <CardC title={title} type='back' showContent titleIsShow={false} changeFormPage={(e) => backToMinus(e)} />
        </div>
        <div className={styles.ModalBox}>{children}</div>
      </div>
    );
  }
}

/**
 * 全局弹出时携带的卡片边框
 * @type {{children: Requireable<ReactNodeLike>, backToMinus: Requireable<(...args: any[]) => any>, title: Requireable<string>}}
 */
CardBorderBox.propsTypes = {
  title: PropTypes.string, // 显示的标题
  backToMinus: PropTypes.func, // 返回的函数
  children: PropTypes.node, // 子元素
};
export default CardBorderBox;
